<%@ page contentType="text/html; charset=utf-8"%>
<%@ include file="../../header.jsp"%>
<meta charset="UTF-8" />
<style>
	.ul_{
		width:100%;
		height:auto;
	}
	
	.ul_ li{
		list-style: none;
		float: left;
		width:150px;
		height:40px;
		margin: 10px;
		border:1px solid #ccc;
		line-height: 40px;
		text-align: center;
		position: relative;
		cursor:pointer;
	}
	.ul_ li .glyphicon-remove{
		position: absolute;
		display: none;
		top: 0;
		right: 0;
	}
	.ul_ li:hover .glyphicon-remove{
		display:block;
	}
</style>
<script>
$(function(){
	$(".brand").click(function(){
		var brand = $("#brand").val();
		if(brand == "") {
			alert("品牌你啥也没写！"); 
			return;
			}
		$.post(ctx + "/post/addproperty",{
			name:brand,
			type:0
		},function(result){
			result_(result);
		});
	});
	
	$(".location").click(function(){
		var location = $("#location").val();
		if(location == ""){
			alert("地点你啥也没写！"); 
			return;}
		$.post(ctx + "/post/addproperty",{
			name:location,
			type:2
		},function(result){
			result_(result);
		});
	});
	
	$(".glyphicon-remove").click(function(){
		var id = $(this).attr("data-h");
		$.post(ctx+"/post/deletebrandlocation",{
			id:id
		},function(result){
			result_(result);
		});
	});
	
});
</script>
<div class="container">
<div class="panel panel-info">
   <ol class="breadcrumb">
  <li><a href="#">晒单</a></li>
  <li><a href="#" class="active">图片属性</a></li>
</ol>
</div>
<div class="panel panel-info">
   <div class="panel-heading">
      <h3 class="panel-title">品牌</h3>
   </div>
   <div class="panel-body">
    <form class="form-inline" role="form">
   		<div class="form-group">
      <label class="sr-only" for="name">品牌名称</label>
      <input type="text" class="form-control" id="brand" 
         placeholder="请输入品牌名称">
   	</div>
   <button type="button" class="btn btn-default brand">添 加</button>
	</form>
	<ul class="ul_">
		<c:forEach items="${brands }" var="bean">
		<li>${bean.name }<span class="glyphicon glyphicon-remove" data-h="${bean.id }"></span></li>
		</c:forEach>
	</ul>
   </div>
</div>
<div class="panel panel-info">
   <div class="panel-heading">
      <h3 class="panel-title">地点</h3>
   </div>
   <div class="panel-body">
      		<form class="form-inline" role="form">
   		<div class="form-group">
      <label class="sr-only" for="name">地点</label>
      <input type="text" class="form-control" id="location" 
         placeholder="请输入地点">
   	</div>
   <button type="button" class="btn btn-default location">添 加</button>
	</form>
	<ul class="ul_">
		<c:forEach items="${locations }" var="bean">
		<li>${bean.name }<span class="glyphicon glyphicon-remove" data-h="${bean.id }"></span></li>
		</c:forEach>
	</ul>
   </div>
</div>
</div>
<script>
	
</script>